﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
using Teigha.Core;

namespace Teigha.TD
{
	public class OdAveRenderOption : IDisposable
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdAveRenderOption(IntPtr cPtr, bool cMemoryOwn)
		{
			this.swigCMemOwn = cMemoryOwn;
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdAveRenderOption obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdAveRenderOption()
		{
			this.Dispose();
		}

		public virtual void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							TD_DbPINVOKE.delete_OdAveRenderOption(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
		}

		public bool getRenderOption(OdDbDatabase pDb)
		{
			bool result = TD_DbPINVOKE.OdAveRenderOption_getRenderOption(this.swigCPtr, OdDbDatabase.getCPtr(pDb));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdResult writeRenderOption(OdDbDatabase pDb)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdAveRenderOption_writeRenderOption(this.swigCPtr, OdDbDatabase.getCPtr(pDb));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdAvePref m_Pref
		{
			get
			{
				IntPtr intPtr = TD_DbPINVOKE.OdAveRenderOption_m_Pref_get(this.swigCPtr);
				OdAvePref result = (intPtr == IntPtr.Zero) ? null : new OdAvePref(intPtr, false);
				if (TD_DbPINVOKE.SWIGPendingException.Pending)
				{
					throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
			set
			{
				TD_DbPINVOKE.OdAveRenderOption_m_Pref_set(this.swigCPtr, OdAvePref.getCPtr(value));
				if (TD_DbPINVOKE.SWIGPendingException.Pending)
				{
					throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
				}
			}
		}

		public OdAveFullOpt m_FullOpt
		{
			get
			{
				IntPtr intPtr = TD_DbPINVOKE.OdAveRenderOption_m_FullOpt_get(this.swigCPtr);
				OdAveFullOpt result = (intPtr == IntPtr.Zero) ? null : new OdAveFullOpt(intPtr, false);
				if (TD_DbPINVOKE.SWIGPendingException.Pending)
				{
					throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
			set
			{
				TD_DbPINVOKE.OdAveRenderOption_m_FullOpt_set(this.swigCPtr, OdAveFullOpt.getCPtr(value));
				if (TD_DbPINVOKE.SWIGPendingException.Pending)
				{
					throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
				}
			}
		}

		public OdAveScanlOpt m_ScanlOpt
		{
			get
			{
				IntPtr intPtr = TD_DbPINVOKE.OdAveRenderOption_m_ScanlOpt_get(this.swigCPtr);
				OdAveScanlOpt result = (intPtr == IntPtr.Zero) ? null : new OdAveScanlOpt(intPtr, false);
				if (TD_DbPINVOKE.SWIGPendingException.Pending)
				{
					throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
			set
			{
				TD_DbPINVOKE.OdAveRenderOption_m_ScanlOpt_set(this.swigCPtr, OdAveScanlOpt.getCPtr(value));
				if (TD_DbPINVOKE.SWIGPendingException.Pending)
				{
					throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
				}
			}
		}

		public OdAveRaytrOpt m_RaytrOpt
		{
			get
			{
				IntPtr intPtr = TD_DbPINVOKE.OdAveRenderOption_m_RaytrOpt_get(this.swigCPtr);
				OdAveRaytrOpt result = (intPtr == IntPtr.Zero) ? null : new OdAveRaytrOpt(intPtr, false);
				if (TD_DbPINVOKE.SWIGPendingException.Pending)
				{
					throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
			set
			{
				TD_DbPINVOKE.OdAveRenderOption_m_RaytrOpt_set(this.swigCPtr, OdAveRaytrOpt.getCPtr(value));
				if (TD_DbPINVOKE.SWIGPendingException.Pending)
				{
					throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
				}
			}
		}

		public OdAveRFileOpt m_RFileOpt
		{
			get
			{
				IntPtr intPtr = TD_DbPINVOKE.OdAveRenderOption_m_RFileOpt_get(this.swigCPtr);
				OdAveRFileOpt result = (intPtr == IntPtr.Zero) ? null : new OdAveRFileOpt(intPtr, false);
				if (TD_DbPINVOKE.SWIGPendingException.Pending)
				{
					throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
			set
			{
				TD_DbPINVOKE.OdAveRenderOption_m_RFileOpt_set(this.swigCPtr, OdAveRFileOpt.getCPtr(value));
				if (TD_DbPINVOKE.SWIGPendingException.Pending)
				{
					throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
				}
			}
		}

		public OdAveFogOpt m_FogOpt
		{
			get
			{
				IntPtr intPtr = TD_DbPINVOKE.OdAveRenderOption_m_FogOpt_get(this.swigCPtr);
				OdAveFogOpt result = (intPtr == IntPtr.Zero) ? null : new OdAveFogOpt(intPtr, false);
				if (TD_DbPINVOKE.SWIGPendingException.Pending)
				{
					throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
			set
			{
				TD_DbPINVOKE.OdAveRenderOption_m_FogOpt_set(this.swigCPtr, OdAveFogOpt.getCPtr(value));
				if (TD_DbPINVOKE.SWIGPendingException.Pending)
				{
					throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
				}
			}
		}

		public OdAveBGOpt m_BGOpt
		{
			get
			{
				IntPtr intPtr = TD_DbPINVOKE.OdAveRenderOption_m_BGOpt_get(this.swigCPtr);
				OdAveBGOpt result = (intPtr == IntPtr.Zero) ? null : new OdAveBGOpt(intPtr, false);
				if (TD_DbPINVOKE.SWIGPendingException.Pending)
				{
					throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
			set
			{
				TD_DbPINVOKE.OdAveRenderOption_m_BGOpt_set(this.swigCPtr, OdAveBGOpt.getCPtr(value));
				if (TD_DbPINVOKE.SWIGPendingException.Pending)
				{
					throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
				}
			}
		}

		public OdAveRenderOption() : this(TD_DbPINVOKE.new_OdAveRenderOption(), true)
		{
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		private object locker = new object();

		private HandleRef swigCPtr;

		protected bool swigCMemOwn;
	}
}
